FROM node:12.15.0-alpine3.11
MAINTAINER      zeze<zezecn@163.com>
ENV TZ          "Asia/Shanghai"
ENV VERSION 	1.8.3

WORKDIR /usr/src/yapi

COPY entrypoint.sh .
COPY install.sh .

RUN chmod +x entrypoint.sh && chmod +x install.sh && \
    sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories && \
    apk add --no-cache bash git python make openssl gcc wget tar && \
	wget http://registry.npm.taobao.org/yapi-vendor/download/yapi-vendor-${VERSION}.tgz && \
	tar xvf yapi-vendor-${VERSION}.tgz && rm -rf yapi-vendor-${VERSION}.tgz && mv package vendors && \
	cp vendors/config_example.json config.json && \
	cd vendors && \
	npm config set registry https://registry.npm.taobao.org && \
	npm install -g node-gyp yapi-cli pm2 && \
	npm install --production

EXPOSE 3000

ENTRYPOINT ["/usr/src/yapi/entrypoint.sh"]

